﻿using System.Threading;
using System.Windows;
using Projecturo.Model;

namespace Projecturo.ProjecturoClient.Security
{
    public static class SecurityDescriptor
    {
        public static Visibility IsAdminVisibility
        {
            get
            {
                User user = Thread.CurrentPrincipal as User;
                if (user != null && user.Role == UserRoles.Administrator)
                {
                    return Visibility.Visible;
                }
                return Visibility.Collapsed;
            }
        }

        public static bool IsAdmin
        {
            get
            {
                User user = Thread.CurrentPrincipal as User;
                if (user != null && user.Role == UserRoles.Administrator)
                {
                    return true;
                }
                return false;
            }
        }
    }
}
